package com.itheima.dao;

import com.itheima.domain.Book;

import java.util.List;

@Mapper
public interface BookDao {

    @Select("select * from tbl_book")
    List<Book> getAll();

    // id查询
    @Select("select * from tbl_book where id = #{id}")
    Book getById(Integer id);

    //新增
    @Insert("insert into tbl_book(id, TYPE, NAME, description) values(null,#{type},#{name},#{description}) ")
    int save(Book book);

    //修改
    @Update("update tbl_book set TYPE = #{type}, NAME = #{name}, description = #{description} " +
            "where id = #{id}")
    int update(Book book);

    //删除
    @Delete("delete from tbl_book where id = #{id}")
    int delete(Integer id);
}
